package com.linkage.educloud.ah.mvp.model;

import com.linkage.educloud.ah.bean.test.TestApiResult1;
import com.linkage.educloud.ah.http.Method;
import com.linkage.educloud.ah.mvp.contract.ISplashContract;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallClazzProxy;
import com.zhouyou.http.model.ApiResult;
import com.zhouyou.http.model.HttpParams;

import io.reactivex.Observable;

/**
 * <desc>
 * Created by The Moss on 2018/8/6.
 */

public class SplashModel implements ISplashContract.ISplashModel {
    @Override
    public Observable<String> request(Method method, boolean isToken, HttpParams params) {
        switch (method) {
            case GET:
                return EasyHttp.get("")
                        .params(params)
                        .accessToken(isToken)
//                        .sign(true)
                        .execute(new CallClazzProxy<TestApiResult1<String>, String>(String.class) {
                        });
            case POST:
            default:
                return EasyHttp.post("")
                        .params(params)
                        .accessToken(isToken)
//                        .sign(true)
                        .execute(new CallClazzProxy<ApiResult<String>, String>(String.class) {
                        });
        }
    }
    
}
